package com.example.gzysmartcity.ui.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.gzysmartcity.R;
import com.example.gzysmartcity.repository.model.News;

import org.jetbrains.annotations.NotNull;

public class SearchNewsAdapter extends BaseQuickAdapter<News, BaseViewHolder> {
    public SearchNewsAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, News news) {
        ImageView imageView = baseViewHolder.getView(R.id.imgRvItemSearchNews);
        Glide.with(getContext()).load(news.getImgUrl()).placeholder(R.drawable.error).into(imageView);
        baseViewHolder.setText(R.id.tvRvItemSearchNews, news.getTitle());
    }
}
